1. Field of the Invention
Methods and apparatuses consistent with the present invention relate to encoding flags and decoding flags. More particularly, the present invention relates to flag encoding and decoding which can be efficiently performed by using spatial correlation between various flags included in macroblocks.
2. Description of the Related Art
With the development of information communication technology, including the Internet, video communication as well as text and voice communication, has increased dramatically. Conventional text communication cannot satisfy users' various demands, and thus, multimedia services that can provide various types of information such as text, pictures, and music have increased. However, multimedia data requires storage media that have a large capacity and a wide bandwidth for transmission because the amount of multimedia data is usually large. Accordingly, a compression coding method is requisite for transmitting multimedia data including text, video, and audio.
A basic principle of data compression is to remove data redundancy. Data can be compressed by removing spatial redundancy in which the same color or object is repeated in an image, temporal redundancy in which there is little change between adjacent frames in a moving picture frame or the same sound is repeated in audio, or mental visual redundancy which takes into account human eyesight and its limited perception of high frequency. In general video coding, temporal redundancy is removed by temporal filtering based on motion estimation, and spatial redundancy is removed by spatial transform.
Lossy encoding is performed on the result obtained by removing data redundancy according to quantization steps of a quantization process. Lossless encoding is finally performed on the quantized result by entropy coding.
Examples of an entropy coding mode now used in an H.264 standard include CAVLC (Context-Adaptive Variable Length Coding), CABAC (Context-Adaptive Binary Arithmetic Coding), Exp_Golomb (exponential Golomb), and the like. The following Table 1 shows entropy coding modes used for every parameter coded with the H.264 standard.
TABLE 1CodedparameterEntropy_coding_mode = 0Entropy_coding_mode = 1MacroblockExp_GolombCABACtypeMacroblockpatternQuantizationparameterReferenceframe indexMotionvectorResidualCAVLCdata
In Table 1, if an entropy_coding_mode flag is 0, a macroblock type indicating whether a corresponding macroblock is in an inter-prediction mode or an intra-prediction mode, a macroblock pattern indicating types of sub-blocks constituting a macroblock, a quantization parameter serving as an index for determining a quantization step, a reference frame index indicating a number of frames referenced in the inter-prediction mode, and a motion vector are encoded by Exp_Golomb. In addition, residual data that indicates the difference between an original image and a prediction image is encoded by CAVLC.
In contrast, if the entropy_coding_mode flag is 1, all the parameters are encoded by CABAC.
The CABAC represents a superior performance in parameters having high complexity. Accordingly, VLC (Variable Length Coding) based entropy coding, such as CAVLC, is set as a fundamental profile.
Meanwhile, in the H.264 or multi-layer based scalable video coding (also referred to as H.264SE (scalable edition)), there are various flags related to whether inter-layer information is used. These flags are set for each of slices, macroblocks, or sub-blocks. Accordingly, overhead increased by the flags cannot be ignored in video coding.
However, as opposed to the text data or the motion data, the flags are currently encoded without taking into consideration of spatial correlation thereof or not encoded.